import React from 'react'
import { Navigate } from 'react-router-dom'
const useSw = (Sw) => {
    return function () {
        const token = localStorage.getItem('token')
        if (token) {
            return <Sw></Sw>
        }
        else {
            return <Navigate to='/login'></Navigate>
        }
    }
}

export default useSw
